import java.util.Scanner;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/4/12
 * Time:19:39
 **/
public class Main1 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            int n = scanner.nextInt();
            scanner.nextLine();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = scanner.nextInt();
            }

            int flag = 0;//用一个标志来判断递增、递减、不变
            int count = 1;//表示分的段数
            for (int i = 1; i < n; i++) {
                if(array[i]>array[i-1]){//递增
                    if(flag == 0){
                        flag = 1;
                    }
                    if(flag == -1){
                        flag = 0;
                        count++;//表示增变减，得分段了
                    }
                }else if(array[i]<array[i-1]) {//递减
                    if(flag == 0){
                        flag = -1;
                    }
                    if(flag == 1){//减变增
                        flag = 0;
                        count++;
                    }
                }
            }
            System.out.println(count);
        }
    }
}
